package org.xi.structural.flyweight;

import org.xi.structural.flyweight.api.Icon;
import org.xi.structural.flyweight.factory.IconFactory;

public class Main {
    public static void main(String[] args) {
        IconFactory factory = new IconFactory();

        Icon circleIcon = factory.getIcon("circle");
        circleIcon.draw(10, 20, 30, "red"); // 使用红色、大小30的圆圈图标

        Icon squareIcon = factory.getIcon("square");
        squareIcon.draw(50, 60, 40, "blue"); // 使用蓝色、大小40的正方形图标

        Icon circleIconAgain = factory.getIcon("circle"); // 重用之前创建的圆圈图标
        circleIconAgain.draw(90, 100, 30, "green"); // 绿色、大小30的圆圈图标
    }
}